<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 19-6-3
 * Time: 上午10:20
 */

namespace api\modules\dict\controllers;


use common\models\credit_old_app\SlDict;
use wodrow\yii\rest\Controller;

class DqController extends Controller
{
    /**
     * 贷前字典数据获取
     * @desc get/post
     * @param string $type 类型
     * @return array
     */
    public function actionList($type = '学历')
    {
        $this->onlyDataOut = true;
        $query = SlDict::find()->where(['d_status' => "ok"]);
        if (in_array($type, ['国产车', '进口车'])){
            $query->andWhere(['d_type' => "汽车车型", 'd_ftext' => $type]);
        }else{
            $query->andWhere(['d_type' => $type]);
        }
        $data = $query->asArray()->all();
//        $r = [
//            'msg' => "获取成功",
//            'errcode' => 0,
//            'data' => $data,
//        ];
        return $data;
    }
}